import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:jdflutter/flutter_jdshop/routers/router.dart';
/// 导入provider
import 'package:provider/provider.dart';
import 'provider/Counter.dart';
import 'provider/Cart.dart';

void main()=>runApp(MyApp());


class MyApp extends StatefulWidget {
  MyApp({Key? key}) : super(key: key);

  _MyAppState createState() => _MyAppState();
}
/// 全局监听状态
class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    //ScreenUtil.instance = ScreenUtil(width: 750, height: 1334, allowFontScaling: true)..init(context);
    //ScreenUtil.init()
    return MultiProvider(
      providers: [
        ChangeNotifierProvider(create: (_)=> Counter()),
        ChangeNotifierProvider(create: (_)=> Cart()),

      ],
      child: ScreenUtilInit(
        designSize: Size(750, 1334),  //配置设计稿的宽度高度
        builder: () => MaterialApp(
          // home: Tabs(),
            initialRoute: '/',
            onGenerateRoute: onGenerateRoute,
            // 设置主题
            theme:ThemeData(
                primaryColor:Colors.white
            )
        ),
      ),
    );
  }
}
